<template>
  <a-card :bordered="false">
    <div style="display: flex; justify-content: space-between">
      <!-- 操作按钮区域 -->
      <div class="table-operator">
        <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
        <!--<a-button type="primary" icon="download" @click="handleExportXls('订单表')">导出</a-button>
      <a-upload
        name="file"
        :showUploadList="false"
        :multiple="false"
        :headers="tokenHeader"
        :action="importExcelUrl"
        @change="handleImportExcel"
      >
        <a-button type="primary" icon="import">导入</a-button>
      </a-upload> -->
        <a-dropdown v-if="selectedRowKeys.length > 0">
          <a-menu slot="overlay">
            <a-menu-item key="1" @click="batchDel"><a-icon type="delete" />删除</a-menu-item>
          </a-menu>
          <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
        </a-dropdown>
      </div>
      <!-- 查询区域 -->
      <div class="table-page-search-wrapper">
        <a-form layout="inline" @keyup.enter.native="searchQuery">
          <a-form-item label="标签标题" style="margin-right: 10px">
            <a-input placeholder="请输入标签标题" v-model="queryParam.userId"></a-input>
          </a-form-item>
          <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
            <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
            <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
          </span>
        </a-form>
      </div>
    </div>
    <!-- table区域-begin -->
    <div class="ant-alert ant-alert-info" style="margin-bottom: 16px">
      <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择
      <a style="font-weight: 600">{{ selectedRowKeys.length }}</a
      >项
      <a style="margin-left: 24px" @click="onClearSelected">清空</a>
    </div>
    <a-table
      ref="table"
      size="middle"
      bordered
      rowKey="id"
      :columns="columns"
      :dataSource="dataSource"
      :pagination="ipagination"
      :loading="loading"
      class="j-table-force-nowrap"
      :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
      @change="handleTableChange"
    >
      <span slot="title" slot-scope="text, record">
        <a-tag color="green" v-if="record">
          {{ record.title }}
        </a-tag>
      </span>
      <span slot="action" slot-scope="text, record">
        <a @click="handleEdit(record)">编辑</a>
        <a-divider type="vertical" />
        <a-dropdown>
          <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
          <a-menu slot="overlay">
            <a-menu-item>
              <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                <a>删除</a>
              </a-popconfirm>
            </a-menu-item>
          </a-menu>
        </a-dropdown>
      </span>
    </a-table>
    <!-- table区域-end -->
    <!-- 表单区域 -->
    <xhdjEvaluationLabelModal ref="modalForm" @ok="modalFormOk"></xhdjEvaluationLabelModal>
    <!-- <XhdjOrderInfoDialog ref="dialogForm"></XhdjOrderInfoDialog> -->
  </a-card>
</template>

<script>
import '@/assets/less/TableExpand.less'
import xhdjEvaluationLabelModal from './modules/xhdjEvaluationLabelModal'
import { getAction } from '@/api/manage'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
export default {
  name: 'xhdjEvaluationLabelList',
  mixins: [JeecgListMixin],
  components: {
    xhdjEvaluationLabelModal
  },
  data () {
    return {
      description: '订单标签页面',
      options: [
        { label: '车费', value: '0' },
        { label: '服务', value: '1' }
      ],
      // 表头
      columns: [
        {
          title: '标签名称',
          align: 'center',
          dataIndex: 'title',
          scopedSlots: { customRender: 'title' }
        },
        {
          title: '创建日期',
          width: 220,
          align: 'center',
          dataIndex: 'createTime'
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          width: 120,
          scopedSlots: { customRender: 'action' }
        }
      ],
      url: {
        list: '/coach/xhdjCoachSrviceLable/list',
        delete: '/coach/xhdjCoachSrviceLable/delete',
        deleteBatch: '/coach/xhdjCoachSrviceLable/deleteBatch'
      }
    }
  },
  computed: {
    importExcelUrl: function () {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
    }
  },
  methods: {
    // 通过
    handlePass (id) {
      getAction(this.url.passUrl, { id }).then(res => {
        if (res.code == 200) {
          that.$message.success(res.message)
          this.loadData()
        } else {
          that.$message.console.error(res.message)
        }
      })
    },
    handleReject (id) {
      getAction(this.url.reject, { id }).then(res => {
        if (res.code == 200) {
          that.$message.success(res.message)
          this.loadData()
        } else {
          that.$message.console.error(res.message)
        }
      })
    }
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
.ant-row {
  display: flex;
  justify-content: flex-end;
}
.ant-col {
  display: flex;
  justify-content: flex-end;
}
.ant-form {
  display: flex;
}
</style>
